<?php
class Content_model extends DNN_model
{
	protected  $_table = 'site_contents';
	
	private $_content = 'content_en';
	function __construct() {
		parent::__construct();
		$_content = 'content_'.$this->_language;
	}
	
	function get_paged_list($limit = 10, $offset = 0) {
		$this->db->select('id, name, '.$this->_content.' as content');
		$this->db->from($this->_table);
		$this->db->order_by('name','asc');
		$this->db->limit($limit, $offset);
		return $this->db->get();
	}
	
	function get_by_id($id) {
		$this->db->select('id, name, '.$this->_content.' as content');
		$this->db->from($this->_table);
		$this->db->where('id', $id);
		return $this->db->get();
	}
	
	function get_by_name($name) {
		$this->db->select('id, name, '.$this->_content.' as content');
		$this->db->from($this->_table);
		$this->db->where('name', $name);
		return $this->db->get();
	}
}
?>